@if(Session::has('errors'))
<div id="panel-error" class="row">
	<div class="col-md-12">
		<div class="panel panel-red panel-minimal">
			<header class="panel-heading">{{trans('form.error')}}</header>
			<div class="panel-body">
				@foreach($errors as $error)
					{{$error['message']}} <br />
				@endforeach
			</div>
		</div>
	</div>
</div>
@endif

<div class='row'>
	<div class='col-md-12'>
		<div class="panel panel-default">
			<!--<header class="panel-heading">{{ trans('user.create') }}</header>-->
			<div class="panel-body">
				{{Form::open(array('method' => 'post', 'class' => 'form-horizontal', 'url' => 'admin/user/save'))}}
					<div class="form-group">
						{{Form::label('group', trans('user.name'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::text('name', (isset($user->name))? $user->name : null, array('class' => 'form-control', 'id' => 'group', 'placeholder' => trans('user.name')))}}
						</div>
					</div>

					<div class="form-group">
						{{Form::label('group', trans('user.email'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::text('email', (isset($user->email))? $user->email : null, array('class' => 'form-control', 'id' => 'group', 'placeholder' => trans('user.email')))}}
						</div>
					</div>

					<div class="form-group">
						{{Form::label('group', trans('user.phonenumber'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::text('phone_number', (isset($user->phone_number))? $user->phone_number : null, array('class' => 'form-control', 'id' => 'group', 'placeholder' => trans('user.phonenumber')))}}
						</div>
					</div>

					<div class="form-group">
						{{Form::label('group', trans('user.group'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::select('group', $group, (isset($user->group))? $user->group : 0, array('class' => 'form-control'))}}
						</div>
					</div>

					<div class="form-group">
						{{Form::label('group', trans('user.active'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::select('active', array('1' => trans('form.yes'), '0' => trans('form.no')), (isset($user->active))? $user->active : 0, array('class' => 'form-control'))}}
						</div>
					</div>

					<div class="form-group">
						{{Form::label('group', trans('user.password'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::password('password', array('class' => 'form-control', 'placeholder' => trans('user.password')))}}
						</div>
					</div>

					<div class="form-group">
						{{Form::label('group', trans('user.repassword'), array('class' => 'col-sm-2 control-label'))}}
						<div class="col-sm-5">
							{{Form::password('repassword', array('class' => 'form-control', 'placeholder' => trans('user.repassword')))}}
						</div>
					</div>

					<div class="form-group">
						<div class="col-sm-2"></div>
						<div class="col-sm-5">
							{{Form::submit(trans('form.save'), array('class' => 'btn btn-primary btn-lg'))}}
							{{Form::button(trans('form.cancel'), array('class' => 'btn btn-default btn-lg', 'id' => 'cancel'))}}
						</div>
					</div>

					{{Form::hidden('id', (isset($user->id))? $user->id : 0, array('id' => 'id'))}}
					{{Form::hidden('type', 'user', array('id' => 'type'))}}
				{{Form::close()}}
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
	$("button#cancel").click(function(event) {
		/* Act on the event */
		var url = '{{URL::to('admin/user/')}}';

		window.location = url;
	});
});
</script>